package com.unitd.frame.sso.starter;

import com.unitd.frame.sso.common.config.SSOConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @desc SSO支持SpringBoot而增加的starter 启动配置对象,在SpringBoot项目中,增加相应的注解
 * @filename SsoAutoConfiguration.java
 * @copyright www.unitd.com
 * @author Hudan
 * @version 1.0
 * @date 2018/1/10
 */
@Configuration
@EnableConfigurationProperties(SsoProperties.class)
public class SsoAutoConfiguration {

	@Autowired
	private SsoProperties properties;

	/**
	 * 注入初始化
	 */
	@Bean
	public SSOConfig getInstance() {
		return SSOConfig.init(properties.getConfig());
	}
}